#include "src/misc.h"

using namespace std;
using namespace cv;

RNG rng(3);
Mat backGround;



int main() {
    TGPolygon polygon1, polygon2, polygon3;
    vector<TGPoint>pts1, pts2;
    generateRandomPointSet(10, rng, pts1);
    generateRandomPointSet(10, rng, pts2);
    findConvexHullWithGraham(pts1, polygon1);
    findConvexHullWithGraham(pts2, polygon2);

    backGround = Mat(1100, 1500, CV_8UC3, White);
    drawPoints(backGround, Red, pts1);
    drawPoints(backGround, Red, pts2);
    // drawPolygon(backGround, polygon1, Blue, false);
    // drawPolygon(backGround, polygon2, Blue, false);

    // antiClockwiseAndRemoveDuplicate(polygon1);
    // antiClockwiseAndRemoveDuplicate(polygon2);
    auto pts3 = mincowskySum(polygon1, polygon2);
    polygon3.data = pts3;
    //cout << pts3[0].x << pts3[1].y << endl;
    //findConvexHullWithGraham(pts3, polygon3);
    // antiClockwiseAndRemoveDuplicate(polygon3);

    // cout << dst1.data.size() << endl;
    drawPolygon(backGround, polygon3, Green, false);

    waitKey(0);
    destroyAllWindows();
    return 0;
}